package kosta.model.dao;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import kosta.model.vo.AdminVO;
import kosta.model.vo.MemberVO;
import kosta.model.vo.MessageVO;
import kosta.model.vo.SearchVO;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AdminDAOImpl implements AdminDAO{
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public AdminVO adminLogin(AdminVO vo) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.selectOne("admin.adminLogin",vo);
	}
	

	@Override
	public List<MemberVO> getMemberList(SearchVO svo) {
		
		return sqlSessionTemplate.selectList("admin.getMemberList",svo);
	}
	
	
	@Override
	public int totalMemberContent(SearchVO svo) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.selectOne("admin.totalMemberContent",svo);
	}

	@Override
	public void updateMemberGrade(MemberVO mvo) {
		
		sqlSessionTemplate.update("admin.updateMemberGrade",mvo);
		
	}

	@Override
	public void dropOutMember(MemberVO mvo) {
		sqlSessionTemplate.update("member.dropOutMember",mvo);
		
	}
	public void adminDelete(int boardNo){
		sqlSessionTemplate.delete("admin.adminDelete",boardNo);
	}


	@Override
	public int deleteRequestCheckListCount() {
		return sqlSessionTemplate.delete("admin.deleteRequestCheckListCount");
	}


	@Override
	public List deleteRequestCheckList() {
		return sqlSessionTemplate.selectList("admin.deleteRequestCheckList");
	}
	
	@Override
	public void adminDeleteFromAuctionRegister(HashMap map) {
		sqlSessionTemplate.delete("admin.adminDeleteFromAuctionRegister", map);
	}

	@Override
	public void adminDeleteFromDeleteConfirm(HashMap map) {
		sqlSessionTemplate.delete("admin.adminDeleteFromDeleteConfirm", map);
	}

	@Override
	public void adminSendDeleteMessage(MessageVO msvo) {
		sqlSessionTemplate.insert("admin.adminSendDeleteMessage", msvo);
	}


	@Override
	public int adminIdDuplCheck(String id) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.selectOne("admin.adminIdDuplCheck",id);
	}	
	@Override
	public void downGrade(String memberId){
		sqlSessionTemplate.update("admin.downGrade",memberId);
	}
	
	@Override
	public void refuseAdminDelete(HashMap map){
		 sqlSessionTemplate.update("admin.refuseAdminDelete",map);
	}


	@Override
	public void adminDeleteFromBid(HashMap map) {
		 sqlSessionTemplate.delete("admin.adminDeleteFromBid",map);		
	}
	



}
